package cn.seaboot.admin.user.authority;

import cn.seaboot.admin.user.bean.Role;
import cn.seaboot.admin.user.service.RoleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 系统角色 [t_sys_role] - Controller
 * <p>
 *
 * @author Mr.css on 2018-6-20
 */
@Controller
@RequestMapping("authority/role")
@Tag(name = "系统角色 [t_sys_role] 管理")
public class RoleAuthorityCtrl {

    @Resource
    private RoleService roleService;

    /**
     * 查列表
     *
     * @return list
     */
    @ResponseBody
    @Operation(description = "系统角色 [t_sys_role] 查询全部角色")
    @RequestMapping(value = "list", method = RequestMethod.GET)
    public List<Role> queryList(@RequestParam Map<String, Object> params) {
        return roleService.queryList(params);
    }

    /**
     * 查列表
     *
     * @return list
     */
    @ResponseBody
    @Operation(description = "系统角色 [t_sys_role] 查询可编辑的角色")
    @RequestMapping(value = "grant", method = RequestMethod.GET)
    public List<Role> grantList(@RequestParam Map<String, Object> params) {
        return roleService.queryList(params);
    }
}
